package shuati.meituan;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @author : LdLtd
 * @Date : 2024/4/6
 * @Description:
 */
public class c030902 {
    public static void main(String[] args) throws IOException {
        StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        in.nextToken();int n=(int)in.nval;
        in.nextToken();int q=(int)in.nval;
        int[] arr = new int [n];
        long sum = 0l;
        long a = 0;
        for (int i = 0; i < n; i++) {
            in.nextToken();
            arr[i] = (int)in.nval;
            if(arr[i]==0) a++;
            sum += (long)arr[i];

        }
        for (int i = 0; i < q; i++) {
            in.nextToken();
            int  left = (int)in.nval;
            in.nextToken();
            int right = (int)in.nval;
            System.out.print(sum+a*left);
            System.out.print(" ");
            System.out.println(sum+a*right);

        }

    }
}
